export default class Polygon {
  constructor({spots, ...other}) {

    let graphics = new PIXI.Graphics();

    const beginSpot = spots.shift();
    const passSpots = Object.assign([], spots);

    if (other.fill) {
      console.log(other.fill);
      graphics.beginFill(other.fill);
    }

    graphics.moveTo(...beginSpot);
    passSpots.forEach(item => {
      graphics.lineTo(...item);
    });
    graphics.lineTo(...beginSpot);
    graphics.endFill();

    graphics.drawRoundedRect(150, 450, 300, 100, 15);

    this.graphics = graphics;

    return this.graphics;
  }
}
